home *** CD-ROM | disk | FTP | other *** search
/ Super PC 28 / Super PC 28 (Shareware para Windows 95 y MS-DOS).iso / spc / bit / setup.mst < prev    next >
Encoding:
Text File  |  1995-06-08  |  11.3 KB  |  328 lines

  1. '**************************************************************************
  2. '*                              Netscape Setup
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10. ''Dialog ID's
  11. CONST WELCOME       = 100
  12. CONST ASKQUIT       = 200
  13. CONST PROGROUP      = 260
  14. CONST DESTPATH      = 300
  15. CONST EXITFAILURE   = 400
  16. CONST EXITQUIT      = 600
  17. CONST EXITSUCCESS   = 700
  18. CONST OPTIONS       = 800
  19. CONST APPHELP       = 900
  20. CONST BADPATH       = 6400
  21.  
  22. ''Bitmap ID
  23. CONST LOGO = 1
  24.  
  25. GLOBAL DEST$        ''Default destination directory.
  26.  
  27. CONST SW_MINIMIZE   = 6
  28. CONST SW_RESTORE    = 9
  29. CONST SW_SHOW       = 5
  30.  
  31. CONST IDYES         = 6
  32.  
  33. DECLARE FUNCTION FindWindow LIB "user" (szClassName$, szWindow$) AS INTEGER
  34. DECLARE SUB      ShowWindow LIB "user" (hwnd%, nCmdShow%)
  35. DECLARE SUB      WinExec LIB "kernel" (szCmdLine$, nCmdShow%)
  36.  
  37. DECLARE SUB      UpdateNetscapeIni LIB "mscuistf.dll" (szIniPath$)
  38.  
  39. DECLARE FUNCTION IsBadWin32s LIB "mscuistf.dll" () AS INTEGER
  40.  
  41. DECLARE SUB      Install
  42. DECLARE SUB      CreateNewsDir (szNetscapeIni$, szNewsDir$)
  43. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  44.  
  45. INIT:
  46.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  47.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  48.  
  49.     SetBitmap CUIDLL$, LOGO
  50.     SetTitle "Netscape Setup"
  51.  
  52.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  53.     IF szInf$ = "" THEN
  54.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  55.     END IF
  56.     ReadInfFile szInf$
  57.  
  58.     ' See if the user is running a version of Win32s less than 1.2
  59.     IF IsBadWin32s() THEN
  60.         szErrText$ = "Version 1.1 of the Netscape Navigator uses OLE 2.02, which is not compatible with this version of Win32s."
  61.         szErrText$ = szErrText + " You must upgrade to Win32s version 1.2 before installing the Netscape Navigator."
  62.         szErrText$ = szErrText + "\nFor more information, please read the Netscape Navigator README.TXT file."
  63.         i% = DoMsgBox(szErrText$, "Netscape Setup", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  64.         END
  65.     END IF
  66.  
  67.     ' If there is an existing Netscape installation then use the current
  68.     ' directory as the default location; otherwise use \NETSCAPE
  69. '    DEST$ = GetIniKeyString("WIN.INI", "Netscape", "ini")
  70.     DEST$ = GetIniKeyString("WIN.INI", "bitMailer", "NetScape")
  71. '    IF DEST$ = "" THEN
  72. '        DEST$ = MID$(GetWindowsDir, 1, 1) + ":\NETSCAPE"
  73. '    ELSE
  74. '        SPLITPATH DEST$, drv$, dir$, filename$, ext$
  75. '        DEST$ = drv$ + MID$(dir$, 1, LEN(dir$) - 1)
  76. '    END IF
  77.  
  78. WELCOME:
  79.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  80.     IF sz$ = "CONTINUE" THEN
  81.         UIPop 1
  82.     ELSE
  83.         GOSUB ASKQUIT
  84.         GOTO WELCOME
  85.     END IF
  86.  
  87. GETPATH:
  88. '    SetSymbolValue "EditTextIn", DEST$
  89. GETPATHL1:
  90. '    sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FGetPathDlgProc", APPHELP, HELPPROC$)
  91. '    DEST$ = GetSymbolValue("EditTextOut")
  92.  
  93. '    IF sz$ = "CONTINUE" THEN
  94. '        IF IsDirWritable(DEST$) = 0 THEN
  95. '            GOSUB BADPATH
  96. '            GOTO GETPATHL1
  97. '        END IF
  98. '        UIPop 1
  99. '    ELSEIF sz$ = "REACTIVATE" THEN
  100. '        GOTO GETPATHL1
  101. '    ELSE
  102. '        GOSUB ASKQUIT
  103. '        GOTO GETPATH
  104. '    END IF
  105.  
  106. CHOOSEGROUP:
  107. '    SetSymbolValue "ProgramGroup", "Netscape"
  108. CHOOSEGROUP1:
  109. '    sz$ = UIStartDlg(CUIDLL$, PROGROUP, "FProgramGroupDlgProc", APPHELP, HELPPROC$)
  110.  
  111. '    IF sz$ = "CONTINUE" THEN
  112. '        UIPop 1
  113. '    ELSEIF sz$ = "REACTIVATE" THEN
  114. '        GOTO CHOOSEGROUP1
  115. '    ELSE
  116. '        GOSUB ASKQUIT
  117. '        GOTO CHOOSEGROUP1
  118. '    END IF
  119.  
  120.     Install
  121.  
  122. QUIT:
  123.     ON ERROR GOTO ERRQUIT
  124.  
  125.     IF ERR = 0 THEN
  126.         IF DoMsgBox("Se ha completado la instalaci≤n. ┐ Quiere ver el fichero README ?", "Netscape Setup", MB_YESNO) = IDYES THEN
  127.             WinExec "NOTEPAD " + MakePath(DEST$, "README.TXT"), SW_SHOW
  128.         END IF
  129.         END
  130.     ELSEIF ERR = STFQUIT THEN
  131.         dlg% = EXITQUIT
  132.     ELSE
  133.         dlg% = EXITFAILURE
  134.     END IF
  135. QUITL1:
  136.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  137.     IF sz$ = "REACTIVATE" THEN
  138.         GOTO QUITL1
  139.     END IF
  140.     UIPop 1
  141.  
  142.     END
  143.  
  144. ERRQUIT:
  145.     i% = DoMsgBox("Setup sources were corrupted!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  146.     END
  147.  
  148. BADPATH:
  149.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  150.     IF sz$ = "REACTIVATE" THEN
  151.         GOTO BADPATH
  152.     END IF
  153.     UIPop 1
  154.     RETURN
  155.  
  156. ASKQUIT:
  157.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  158.  
  159.     IF sz$ = "EXIT" THEN
  160.         UIPopAll
  161.         ERROR STFQUIT
  162.     ELSEIF sz$ = "REACTIVATE" THEN
  163.         GOTO ASKQUIT
  164.     ELSE
  165.         UIPop 1
  166.     END IF
  167.     RETURN
  168.  
  169. '**
  170. '** Purpose:
  171. '**     Creates specified news directory
  172. '** Arguments:
  173. '**     Path to Netscape INI file and directory to create.
  174. '** Returns:
  175. '**     none.
  176. '*************************************************************************
  177. SUB CreateNewsDir (szNetscapeIni$, szNewsDir$) STATIC
  178.     ' Check for a file with the same name as the directory we are trying to create
  179.     IF DoesFileExist(szNewsDir$, femExists) THEN
  180.         ' Try using MOZNEWS as the directory name
  181.         IF DoesFileExist(MakePath(DEST$, "MOZNEWS"), fmExists) = 0 THEN
  182.             CreateDir MakePath(DEST$, "MOZNEWS"), cmoNone
  183.  
  184.             ' Add a line to the Netscape INI file pointing to the news directory
  185.             CreateIniKeyValue szNetscapeIni$, "News", "News Directory", MakePath(DEST$, "MOZNEWS"), cmoOverwrite
  186.         END IF
  187.     ELSE
  188.         CreateDir szNewsDir$, cmoNone
  189.  
  190.         ' Add a line to the Netscape INI file pointing to the news directory
  191.         CreateIniKeyValue szNetscapeIni$, "News", "News Directory", szNewsDir$, cmoOverwrite
  192.     END IF
  193. END SUB
  194.  
  195. '**
  196. '** Purpose:
  197. '**     Builds the copy list and performs all installation operations.
  198. '** Arguments:
  199. '**     none.
  200. '** Returns:
  201. '**     none.
  202. '*************************************************************************
  203. SUB Install STATIC
  204.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  205.     ' Create user specified directory and CACHE sub-directory
  206.     CreateDir DEST$, cmoNone
  207.     CreateDir MakePath(DEST$, "CACHE"), cmoNone
  208.  
  209.     AddSectionFilesToCopyList "Files", SrcDir$, DEST$
  210.  
  211.     ' Files needed for OLE2 go in the Windows SYSTEM directory
  212.     AddSectionFilesToCopyList "OLE2", SrcDir$, GetWindowsSysDir
  213.  
  214.     ' If there is an existing NETSCAPE.INI file then ask the user if they
  215.     ' want to overwrite the existing file
  216.     IF DoesFileExist(MakePath(DEST$, "NETSCAPE.INI"), femExists) THEN
  217.         IF DoMsgBox("Do you want to overwrite the existing NETSCAPE.INI file?", "Netscape Setup", MB_YESNO) = IDYES THEN
  218.             AddSectionFilesToCopyList "INI", SrcDir$, DEST$
  219.         END IF
  220.     ELSE
  221.         AddSectionFilesToCopyList "INI", SrcDir$, DEST$
  222.     END IF
  223.  
  224.     CopyFilesInCopyList
  225.  
  226.     ' Merge OLE2 registration into system registry
  227.     WinExec "REGEDIT /S OLE2.REG", SW_SHOW
  228.  
  229.     ' Modify the win.ini file to have a [Netscape] section with a keyname-value
  230.     ' pair for the Netscape INI file location
  231.     CreateIniKeyValue "WIN.INI", "Netscape", "ini", MakePath(DEST$, "NETSCAPE.INI"), cmoOverwrite
  232.  
  233.     szNetscapeIni$ = MakePath(DEST$, "NETSCAPE.INI")
  234.  
  235.     ' If the user specified an installation location other than the default
  236.     ' location, then update the netscape.ini file accordingly
  237.     IF DEST$ <> "C:\NETSCAPE" THEN
  238.         UpdateNetscapeIni szNetscapeIni$
  239.     END IF
  240.  
  241.     ' See if there is a news directory specified in the INI file
  242.     szNewsDir$ = GetIniKeyString(szNetscapeIni$, "News", "News Directory")
  243.     IF szNewsDir$ = "" THEN
  244.         CreateNewsDir szNetscapeIni$, MakePath(DEST$, "NEWS")
  245.     ELSEIF DoesDirExist(szNewsDir$) = 0 THEN
  246.         CreateNewsDir szNetscapeIni$, szNewsDir$
  247.     END IF
  248.  
  249.     ' Check to see if the NEWSRC file specified in the NETSCAPE.INI actually exists
  250.     szNewsRC$ = GetIniKeyString(szNetscapeIni$, "Main", "News RC")
  251.     IF szNewsRC$ <> "" THEN
  252.         IF DoesFileExist(szNewsRC$, femExists) = 0 THEN
  253.             ' Make the default NEWSRC file be in the NEWS sub-directory
  254.             CreateIniKeyValue szNetscapeIni$, "Main", "News RC", MakePath(DEST$, "NEWS\NEWSRC"), cmoOverwrite
  255.         END IF
  256.     END IF
  257.  
  258.     ' Setup Netscape to use the audio player as an external viewer
  259.     CreateIniKeyValue szNetscapeIni$, "Viewers", "audio/basic", MakePath(DEST$, "NAPLAYER.EXE"), cmoOverwrite
  260.     CreateIniKeyValue szNetscapeIni$, "Viewers", "audio/x-aiff", MakePath(DEST$, "NAPLAYER.EXE"), cmoOverwrite
  261.     CreateIniKeyValue szNetscapeIni$, "Suffixes", "audio/basic", "au,snd", cmoOverwrite
  262.     CreateIniKeyValue szNetscapeIni$, "Suffixes", "audio/x-aiff", "aif,aiff,aifc", cmoOverwrite
  263.  
  264.     ' Make sure that the user doesn't have a home page containing mcom.com
  265.     szHomePage$ = GetIniKeyString(szNetscapeIni$, "Main", "Home Page")
  266. '    IF InStr(LCase$(szHomePage$), "mcom.com") THEN
  267.     ' IF szHomePage$ = "http://home.mcom.com/home/welcome.html" THEN
  268.         CreateIniKeyValue szNetscapeIni$, "Main", "Home Page", "http://www.bitmailer.com/", cmoOverwrite
  269. '    END IF
  270.  
  271.     ' If the user doesn't have an existing cookie file, then see if they have an existing
  272.     ' internetMCI cookie file and if they do make a copy of it
  273.     szCookieFile$ = GetIniKeyString(szNetscapeIni$, "Cookies", "Cookie File")
  274.     IF szCookieFile$ = "" THEN
  275.         szCookieFile$ = MakePath(DEST$, "COOKIES.TXT")
  276.     END IF
  277.     IF DoesFileExist(szCookieFile$, femExists) = 0 THEN
  278.         szInternetMCI$ = GetIniKeyString("WIN.INI", "IMCI", "ini")
  279.         IF szInternetMCI$ <> "" THEN
  280.             szMCICookie$ = GetIniKeyString(szInternetMCI$, "Cookies", "Cookie File")
  281.             IF szMCICookie$ <> "" THEN
  282.                 IF DoesFileExist(szMCICookie$, femExists) THEN
  283.                     CopyFile szMCICookie$, szCookieFile$, cmoNone, 0
  284.                 END IF
  285.             END IF
  286.         END IF
  287.     END IF
  288.  
  289.     ' Show the Program Manager
  290.     ShowWindow FindWindow("PROGMAN", NULL), SW_RESTORE
  291.  
  292.     ' Update program group and program items
  293. '    Group$ = GetSymbolValue("ProgramGroup")
  294. '    Group$ = GetIniKeyString("WIN.INI", "bitMailer", "Grupo")
  295. '    CreateProgmanGroup Group$, "", cmoNone
  296. '    ShowProgmanGroup  Group$, 1, cmoNone
  297. '    SLEEP 1
  298. '    CreateProgmanItem Group$, "Netscape", MakePath(DEST$, "NETSCAPE.EXE"), "", cmoOverwrite
  299.  
  300.     ' Only add a README file icon if this is the default program group
  301. '    if Group$ = "Netscape" then
  302. '        CreateProgmanItem Group$, "Read Me", "notepad "+ MakePath(DEST$, "README.TXT"), "", cmoOverwrite
  303. '    end if
  304. '    SLEEP 1
  305. END SUB
  306.  
  307. '**
  308. '** Purpose:
  309. '**     Appends a file name to the end of a directory path,
  310. '**     inserting a backslash character as needed.
  311. '** Arguments:
  312. '**     szDir$  - full directory path (with optional ending "\")
  313. '**     szFile$ - filename to append to directory
  314. '** Returns:
  315. '**     Resulting fully qualified path name.
  316. '*************************************************************************
  317. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  318.     IF szDir$ = "" THEN
  319.         MakePath = szFile$
  320.     ELSEIF szFile$ = "" THEN
  321.         MakePath = szDir$
  322.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  323.         MakePath = szDir$ + szFile$
  324.     ELSE
  325.         MakePath = szDir$ + "\" + szFile$
  326.     END IF
  327. END FUNCTION
  328.